/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entity;

//import java.awt.Image;
import java.io.Serializable;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;

@Entity
public class Pet implements Serializable{
    
    @Id
    @GeneratedValue(strategy=GenerationType.AUTO) //create prymary key id
    private Long id;
    @Column(nullable = false)
    private String name;
    @Column(nullable = false)
    private String species;
    @Column(nullable = false)
    private int age;
    @Column(nullable = false)
    private float weight;
    
    //private Image picture;
    @ManyToOne//(cascade=CascadeType.PERSIST)
    private Owner owner;            //hasOne owner
    
    public Pet() {
        this.name = "NN";
        this.species = "NS";
        this.age = 0;
        this.weight = 0;
        this.owner = null;
    }

    public Pet(String name, String species, int age, float weight, Owner owner, MedicalRecord record) {
        this.name = name;
        this.species = species;
        this.age = age;
        this.weight = weight;
        this.owner = owner;
    }    
    
    public String getName() {
        return name;
    }

    public String getSpecies() {
        return species;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setSpecies(String species) {
        this.species = species;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }
    
    @Override
    public String toString(){
        return "Id"+id+"    Pet Name: "+name+"      Species: "+species+"\n";
    }
}
